package demo1;

public class Test {
    public static void main(String[] args) {
        Animal animal[] = new Animal[3];
        animal[0] = new Cat("小花猫","公");
        animal[1] = new Dog("小黄狗","公");
        animal[2] = new Duck("大百鸭","母");
        for (int i = 0; i < animal.length; i++) {
            animal[i].eat();
        }
    }
}
